{{ if (index site.Params.show_related .Type) | and (ne .Params.show_related false) | or .Params.show_related }}
  {{ $related := site.RegularPages.Related . | first 3 }}
  {{ with $related }}
  <div class="article-widget content-widget-hr wg-cards mt-5">
    <h3>{{ i18n "related" }}</h3>
    <div class="related cards mt-3 row">
      {{ range . }}
        {{ $post_link := .RelPermalink }}
        <div class="card-wrap col-12 col-sm-6 col-md-4">
          <div class="card container">
            <div class="row pt-4 pr-4 pb-0 pl-4">
              {{/** Image **/}}
              {{ $resource := (.Resources.ByType "image").GetMatch "*featured*" }}
              {{ with $resource }}
                <div class="image col-12 mb-3">
                    {{ $image := .Resize "350x" }}
                    <a href="{{ $post_link }}">
                      <img src="{{ $image.RelPermalink }}" alt="{{ .Title }}">
                    </a>
                </div>
              {{end}}

              {{/** Title **/}}
              <div class="subtitle col-12 mb-2">
                <a href="{{ $post_link }}">{{ .Title }}</a>
              </div>

              {{/** Summary **/}}
              {{ $summary := "" }}
              {{ if .Params.summary }}
                {{ $summary = .Params.summary | markdownify | emojify }}
              {{ else if .Summary }}
                {{ $summary = .Summary }}
              {{ end }}
              {{ with $summary }}
                <div class="text col-12 mb-1">
                  <p>{{ . }}</p>
                </div>
              {{ end }}

              {{/** Button **/}}
              <div class="w-100 mb-4"></div>
              <div class="button">
                <a href="{{ $post_link }}" class="mosaic-btn mosaic-btn-secondary btn-bottom"><span class="prefix">»</span>&nbsp;Read Post</a>
              </div>
            </div>
          </div>
        </div>
      {{ end }}
    </div>
  </div>
  {{ end }}
{{ end }}
